package Monitors.threadLocal;

import lombok.extern.slf4j.Slf4j;


import java.sql.Time;
@Slf4j(topic = "c.TLMethod")
public class TLMethod {

    private static ThreadLocal<String> tl = new ThreadLocal<>();

    private String getContent() {
        return tl.get();
    }

    private void setContent(String content) {
        tl.set(content);
        tl.set(content);

    }

    public static void main(String[] args) {
        TLMethod demo = new TLMethod();
        for (int i = 0; i < 5; i++) {
            int j = i;
            new Thread(() -> {

                demo.setContent(Thread.currentThread().getName() + "的数据");
                log.debug("{} ---> {}",Thread.currentThread().getName(),demo.getContent());
            },"线程"+j).start();
        }
    }
}